const ul = document.getElementById("list")

const lis = ul.getElementsByTagName("li")
console.log(lis);

(Array.from(lis)).forEach(
    (li,i) => {
        console.log("ok");
        li.setAttribute("index",i)
    }
);


ul.addEventListener(
    "click",
    e => {
        console.log(e.target.innerText);
        console.log(e.target.nodeName);
        console.log(e.target.getAttribute("index"));
    }
)